var _EMOTICON_REWRITE = [
	{
		regex : /(:\)|:-\)|:smile:)/g,
		image : "<img src='pcdm_static/emoticons/images/icon_smile.gif'/>"
	},
	{
		regex : /(:D|:-D|:grin:)/g,
		image : "<img src='pcdm_static/emoticons/images/icon_biggrin.gif'/>"
	},
	{
		regex : /(:\(|:-\(|:sad:)/g,
		image : "<img src='pcdm_static/emoticons/images/icon_sad.gif'/>"
	},
	{
		regex : /(:o|:-o|:eek:)/g,
		image : "<img src='pcdm_static/emoticons/images/icon_surprised.gif'/>"
	},
	{
		regex : /(8O|8-O|:shock:)/g,
		image : "<img src='pcdm_static/emoticons/images/icon_eek.gif'/>"
	},
	{
		regex : /(:\?:)/g,
		image : "<img src='pcdm_static/emoticons/images/icon_question.gif'/>"
	},
	{
		regex : /(:\?|:-\?|:\?\?\?:)/g,
		image : "<img src='pcdm_static/emoticons/images/icon_confused.gif'/>"
	},
	{
		regex : /(8\)|8-\)|:cool:)/g,
		image : "<img src='pcdm_static/emoticons/images/icon_cool.gif'/>"
	},
	{
		regex : /(:x|:-x|:mad:)/g,
		image : "<img src='pcdm_static/emoticons/images/icon_mad.gif'/>"
	},
	{
		regex : /(:P|:-P:razz:)/g,
		image : "<img src='pcdm_static/emoticons/images/icon_razz.gif'/>"
	},
	{
		regex : /(:\||:-\||:neutral:)/g,
		image : "<img src='pcdm_static/emoticons/images/icon_neutral.gif'/>"
	},
	{
		regex : /(;\)|;-\)|:wink:)/g,
		image : "<img src='pcdm_static/emoticons/images/icon_wink.gif'/>"
	},
	{
		regex : /(:lol:)/g,
		image : "<img src='pcdm_static/emoticons/images/icon_lol.gif'/>"
	},
	{
		regex : /(:oops:)/g,
		image : "<img src='pcdm_static/emoticons/images/icon_redface.gif'/>"
	},
	{
		regex : /(:cry:)/g,
		image : "<img src='pcdm_static/emoticons/images/icon_cry.gif'/>"
	},
	{
		regex : /(:evil:)/g,
		image : "<img src='pcdm_static/emoticons/images/icon_evil.gif'/>"
	},
	{
		regex : /(:twisted:)/g,
		image : "<img src='pcdm_static/emoticons/images/icon_twisted.gif'/>"
	},
	{
		regex : /(:roll:)/g,
		image : "<img src='pcdm_static/emoticons/images/icon_rolleyes.gif'/>"
	},
	{
		regex : /(:\!:)/g,
		image : "<img src='pcdm_static/emoticons/images/icon_exclaim.gif'/>"
	},
	{
		regex : /(:idea:)/g,
		image : "<img src='pcdm_static/emoticons/images/icon_idea.gif'/>"
	},
	{
		regex : /(:arrow:)/g,
		image : "<img src='pcdm_static/emoticons/images/icon_arrow.gif'/>"
	},
	{
		regex : /(:mrgreen:)/g,
		image : "<img src='pcdm_static/emoticons/images/icon_mrgreen.gif'/>"
	},
]


function handleEmoticonDecoration(context, data) {
	for(var i in _EMOTICON_REWRITE) {
		data = data.replace(_EMOTICON_REWRITE[i].regex, _EMOTICON_REWRITE[i].image);
	}
	
	return data
}

if(typeof chatManager != "undefined") {
	chatManager.insertDataModule(handleEmoticonDecoration);	
}
